﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BaseEntities;
using BussinessLogic;
using DataAccess;

namespace UnitTest
{
    /// <summary>
    /// Summary description for UnitTestUC5
    /// </summary>
    [TestClass]
    public class UnitTestUC5
    {
        public UnitTestUC5()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod]
        public void CheckCardNo()
        {
            CardDAO Card = new CardDAO();
            bool exp = Card.CheckCardNo("12562A434");
            Assert.IsTrue(exp);
        }
        [TestMethod]
        public void CheckCardNo1()
        {
            CardDAO Card = new CardDAO();
            bool exp = Card.CheckCardNo("12562A434aaaa");
            Assert.IsFalse(exp);
        }
        [TestMethod]
        public void CheckCardNo2()
        {
            CardDAO Card = new CardDAO();
            bool exp = Card.CheckCardNo("");
            Assert.IsFalse(exp);
        }
        [TestMethod]
        public void CheckCardNo3()
        {
            CardDAO Card = new CardDAO();
            bool exp = Card.CheckCardNo("12562B434");
            Assert.IsTrue(exp);
        }
        [TestMethod]
        public void CheckCardNo4()
        {
            CardDAO Card = new CardDAO();
            bool exp = Card.CheckCardNo("111111111111");
            Assert.IsFalse(exp);
        }
        /////////////////////////////////
        [TestMethod]
        public void CheckBalance()
        {
            AccountBus Acc = new AccountBus();
            bool exp = Acc.CheckBalance(1000000, "12562B434");
            Assert.IsTrue(exp);
        }
        [TestMethod]
        public void CheckBalance1()
        {
            AccountBus Acc = new AccountBus();
            bool exp = Acc.CheckBalance(100000, "12562B434");
            Assert.IsTrue(exp);
        }
        [TestMethod]
        public void CheckBalance2()
        {
            AccountBus Acc = new AccountBus();
            bool exp = Acc.CheckBalance(100000, "12562B434");
            Assert.IsTrue(exp);
        }
        ///////////////////////////////////
        [TestMethod]
        public void GetCustomerName()
        {
            CustomerDAO Cus = new CustomerDAO();
            string exp = Cus.GetCustomerName("12562A434");
            Assert.AreEqual("Dinh Van An", exp);
        }
        [TestMethod]
        public void GetCustomerName2()
        {
            CustomerDAO Cus = new CustomerDAO();
            string exp = Cus.GetCustomerName("12562B434");
            Assert.AreEqual("Nguyen Van Bang", exp);
        }
        [TestMethod]
        public void UpdateBalanceAccountTransfer()
        {
            AccountBus Acc = new AccountBus();
            bool exp = Acc.UpdateBalanceAccountTransfer(100000, "12562B434");
            Assert.IsTrue(exp);
        }
        [TestMethod]
        public void UpdateBalanceAccountReceive()
        {
            AccountBus Acc = new AccountBus();
            bool exp = Acc.UpdateBalanceAccountReceive(100000, "12562B434");
            Assert.IsTrue(exp);
        }
    }
}
